<script type="text/javascript">
	$(function() {
	    $.getJSON("<?=$this->hvnUrl(array('module' => 'user', 'controller' => 'ajax', 'action' => 'get-user-followship'), 'generic'); ?>",
	        {uid: <?=$this->viewParams['u']->id?>}, 
	        function(json){
	            if (json.followed)
	            {   
//		            $("#follow label").html('<?=$this->viewParams['u']->name?>' + '<?=t(2003)?>');
	               //alert('<?=$this->viewParams['u']->name?>' + '<?=t(2003)?>');
	            }
	            if (json.follows) //now set the unfollow button
	               $("#follow a").html('<?=t(2002) ?>').attr('name', 0); //unfollow me
	            else
	               $("#follow a").html('<?=t(2001) ?>').attr('name', 1); //follow me
	
	
	            $("#ajax_button").click(function(){
		            url = '<?=$this->hvnUrl(array('module' => 'user', 'controller' => 'ajax', 'action' => 'set-user-followship'), 'generic'); ?>';
	                $.getJSON(url, 
	                    {uid: "<?=$this->viewParams['u']->id?>", followship: $(this).attr('name')}, 
	                    function(json){
	                        if (json.success == 1)
	                        {
	                            $("#follow a").html('<?=t(2002) ?>').attr('name', 0); //unfollow me
	                            alert('<?=t(2004)?>');
	                        }
	                        else if (json.success == 2)
	                        {
	                            $("#follow a").html('<?=t(2001) ?>').attr('name', 1); //follow me
	                            alert('<?=t(2005)?>');
	                        }
	                        else
	                        {
	                            alert('<?=t(73)?>');
	                        }
	                });
	                
	            });
	            
	        });
	});
	
</script>
	
<? $sess = new Zend_Session_Namespace(CLU_NS);?>
	<br><br><br>
<?if(isset($this->viewParams['u'])) :?>
	<div class="blog_left_title"><?=$this->viewParams['u']->name ?></div>
    <div class="blog_left_content">
	    <div align="center">
	    	<?//die_a(sprintf($this->viewParams['avatar_image'], "small"));?>
	    	<? if ($this->viewParams['avatar_image']) :?>
				<img src="<?=sprintf($this->viewParams['avatar_image'], "small");?>" alt="avatar"/> 
			<?else :?>
				<img title ="<?=t(469)?>" src="/public/ufiles/0/images/small/avatar/avatar.jpg" alt="avatar"/> <br/><br/>
			<?endif ?>
	    </div>
    
		<?if($sess->userId && $this->viewParams['u']->id != $sess->userId):?>	     
		<div class="blog_left_content_joinfriend"  align="center" id="follow">
			<a id ="ajax_button" href="javascript:void()"></a>
			<br/><label></label>
		</div>
		<?endif?>
    	<div class="clear"></div><br/>
    	<?if($sess->userId && $this->viewParams['u']->id == $sess->userId):?>
			<div class="blog_left_item">
				<table border="0" cellpadding="0" cellspacing="0" width="210">
					<tbody><tr>
						<td width="194">
							<a href="<?=$this->hvnUrl(array('action' => 'mailbox'),'account')?>?id=<?=$this->viewParams['u']->id?>">
								<?=t(1017) ?>
							</a>
						</td>
						<td width="16">
							<a href="<?=$this->hvnUrl(array('action' => 'mailbox'),'account')?>?id=<?=$this->viewParams['u']->id?>">
							<img src="/public/themes/hard/images/blog_bullet_edit.jpg" align="absmiddle">
						</td>
				  	</tr>
					</tbody>
				</table>
			</div>
		
			<div class="blog_left_item">
			<table border="0" cellpadding="0" cellspacing="0" width="210">
			  <tbody><tr>
				<td width="194">
					<a href="<?=$this->hvnUrl(array('action' => 'edit-profile'),'account')?>?id=<?=$this->viewParams['u']->id?>">
						<?=t(448) ?>
					</a>
				</td>
				<td width="16">
					<a href="<?=$this->hvnUrl(array('action' => 'edit-profile'),'account')?>?id=<?=$this->viewParams['u']->id?>">
						<img src="/public/themes/hard/images/blog_bullet_edit.jpg" align="absmiddle">
					</a>
				</td>
			  </tr>
			</tbody></table>
			 </div>
		 
			<div class="blog_left_item">
			<table border="0" cellpadding="0" cellspacing="0" width="210">
			  <tbody><tr>
				<td width="194">
					<a href="<?=$this->hvnUrl(array('action' => 'avatar'),'account')?>?id=<?=$this->viewParams['u']->id?>">
						<?=t(468) ?>
					</a>
				</td>
				<td width="16">
					<a href="<?=$this->hvnUrl(array('action' => 'avatar'),'account')?>?id=<?=$this->viewParams['u']->id?>">
						<img src="/public/themes/hard/images/blog_bullet_edit.jpg" align="absmiddle">
					</a>
				</td>
			  </tr>
			 </tbody></table>
			 </div>
		 
			<div class="blog_left_item">
			<table border="0" cellpadding="0" cellspacing="0" width="210">
			  <tbody><tr>
			  	<td width="194">
					<a href="<?=$this->hvnUrl(array('action' => 'change-pass'),'account')?>?id=<?=$this->viewParams['u']->id?>">
						<?=t(430) ?>
					</a>
				</td>
				<td width="16">
					<a href="<?=$this->hvnUrl(array('action' => 'change-pass'),'account')?>?id=<?=$this->viewParams['u']->id?>">
						<img src="/public/themes/hard/images/blog_bullet_edit.jpg" align="absmiddle">
					</a>
				</td>
			  </tr>
			  </tbody></table>
			 </div>
		 	
		 	<? if( (isset($sess->userId) && get_rid($sess->userId) == 24) || (isset($sess->userId) && (strpos($sess->userPermissions, 'administer everything')))) :?>
		 	<div class="blog_left_item">
				<table border="0" cellpadding="0" cellspacing="0" width="210">
					<tbody><tr>
						<td width="194">
							<a href="<?=$this->hvnUrl(array('action' => 'list-product'),'account')?>?id=<?=$this->viewParams['u']->id?>">
								Product
							</a>
						</td>
						<td width="16">
							<a href="<?=$this->hvnUrl(array('action' => 'list-product'),'account')?>?id=<?=$this->viewParams['u']->id?>">
							<img src="/public/themes/hard/images/blog_bullet_edit.jpg" align="absmiddle">
						</td>
				  	</tr>
					</tbody>
				</table>
			</div>
			<?endif?>
			
			
			
			 <div class="blog_left_item">
			<table border="0" cellpadding="0" cellspacing="0" width="210">
			  <tbody><tr>
				<td width="194">
					<a href="<?=$this->hvnUrl(array('action' => 'change-account-type'),'account')?>?id=<?=$this->viewParams['u']->id?>">
						<?=t(483) ?>
					</a>
				</td>
				<td width="16">
					<a href="<?=$this->hvnUrl(array('action' => 'change-account-type'),'account')?>?id=<?=$this->viewParams['u']->id?>">
						<img src="/public/themes/hard/images/blog_bullet_edit.jpg" align="absmiddle">
					</a>
				</td>
			  </tr>
			  </tbody></table>
			 </div>
			 
			 <div class="blog_left_item">
				<table border="0" cellpadding="0" cellspacing="0" width="210">
					<tbody><tr>
						<td width="194">
							<a href="<?=$this->hvnUrl(array('action' => 'upgrade-account'),'account')?>?id=<?=$this->viewParams['u']->id?>">
								<?=t(450) ?>
							</a>
						</td>
						<td width="16">
							<a href="<?=$this->hvnUrl(array('action' => 'upgrade-account'),'account')?>?id=<?=$this->viewParams['u']->id?>">
							<img src="/public/themes/hard/images/blog_bullet_edit.jpg" align="absmiddle">
						</td>
				  	</tr>
					</tbody>
				</table>
			</div>
			
			<div class="blog_left_item">
				<table border="0" cellpadding="0" cellspacing="0" width="210">
					<tbody><tr>
						<td width="194">
							<a href="<?=$this->hvnUrl(array('action' => 'billing-info'),'account')?>?id=<?=$this->viewParams['u']->id?>">
								<?=t(485) ?>
							</a>
						</td>
						<td width="16">
							<a href="<?=$this->hvnUrl(array('action' => 'billing-info'),'account')?>?id=<?=$this->viewParams['u']->id?>">
							<img src="/public/themes/hard/images/blog_bullet_edit.jpg" align="absmiddle">
						</td>
				  	</tr>
					</tbody>
				</table>
			</div>
			<?else :?>
			<? if((get_rid($_REQUEST['id']) == 24)||(get_rid($_REQUEST['id']) == 25)) :?>
			<div class="blog_left_item">
				<table border="0" cellpadding="0" cellspacing="0" width="210">
					<tr>
						<td width="194">
							<a href="<?=$this->hvnUrl(array('action' => 'list-product'),'account')?>?id=<?=$this->viewParams['u']->id?>">
								Product
							</a>
						</td>
						<td width="16">
							<a href="<?=$this->hvnUrl(array('action' => 'list-product'),'account')?>?id=<?=$this->viewParams['u']->id?>">
							<img src="/public/themes/hard/images/blog_bullet_edit.jpg" align="absmiddle">
						</td>
				  	</tr>
				</table>
			</div>
			<?endif?>
		<?endif ?>
    </div>
<?endif?>
